<?
layout("/inc/layout.html",{title:sysTitle}){
?>
<div id="page-wrapper">
	<!--BEGIN TITLE & BREADCRUMB PAGE-->
	<div id="title-breadcrumb-option-demo" class="page-title-breadcrumb">
		<div class="page-header pull-left">
			<div class="page-title">自然语言处理</div>
		</div>
		<ol class="breadcrumb page-breadcrumb pull-left">
			<li><i class="fa fa-home"></i>&nbsp;<a href="main.html">首页</a>&nbsp;&nbsp;<i
				class="fa fa-angle-right"></i>&nbsp;&nbsp;</li>
			<li>自然语言处理&nbsp;&nbsp;<i class="fa fa-angle-right"></i>&nbsp;&nbsp;</li>
			<li class="active">新词发现</li>
		</ol>
		<div class="clearfix"></div>
	</div>
	<!--END TITLE & BREADCRUMB PAGE-->
	<!--BEGIN CONTENT-->
	<div class="page-content" style="margin-left:50px; margin-right:50px;">
		
		<img src="images/slide2.png" width="70%" height="100px;"/>
		
		<div class="row" style="margin-top: 10px;">
			<!-- <div class="col-lg-12" style="margin-top: 10px;"> -->
				<div class="form-group">
					<div class="col-md-12" style="text-align:center">
						<label for="inputPhone" class="control-label pull-left"><h4>待处理文本:</h4></label>
					</div>
					<div class="col-md-12">
						<textarea id="text" name="text" rows="8" class="form-control"></textarea>
					</div>
				</div>
			<!-- </div> -->
			<div class="col-lg-12" style="margin-top: 10px;">
				<a href="#" onclick="submitForm();" class="btn btn-success pull-left">提交文本<i class="fa fa-rocket"></i></a>
			</div>
		</div>
		
		<div class="row" style="margin-top: 10px;">
			<div class="col-lg-12">
				<div  class="tab-content responsive" style="min-height:300px">
					<!-- 关键词提取 -->
					<div id="dp-6" class="tab-pane fade in active">
						<div class="row">
						
							<div class="col-lg-8" id="buildWordsHtml">
								<h4>结果集：</h4>
								<button type="button" class="btn" style="margin-bottom: 5px; background-color: #EEDFCC; border: 1px solid #EEDFCC;">数据为空！</button>
							</div>
							<div class="col-lg-4" id="buildWordsCategoryHtml">
								<h4>词表来源:</h4>
								<button type="button" class="btn" style="margin-bottom: 5px; background-color: #EEDFCC; border: 1px solid #EEDFCC;">数据为空！</button>
							</div>
							
						</div>
					</div>
				</div>
			</div>
		</div>
		
		

	</div>
	<!--END CONTENT-->
</div>

<link type="text/css" rel="stylesheet" href="static/dependency.css">

<script type="text/javascript" src="static/d3.min.js"></script>
<script type="text/javascript" src="static/lex.js"></script>
<script type="text/javascript" src="static/dependency.js"></script>

<SCRIPT type="text/javascript">

function submitForm() {
	var text = $("#text").val();
	if($.trim(text).length<1) {
		alert("请输入待处理文本");
		return false;
	}
	submitBuildWords(text);
}


//关键词提取
function submitBuildWords(text) {
	$.ajax({
		type: "post",
		url: "nlp-demo-buildWords.html",
		data: {
			"text": text,
		},
		dataType: "json",
		success: function(data) {
			var buildWordsHtml = '<h4>结果集：</h4>';
			var buildWordsCategoryHtml = '<h4>词表来源:</h4>';
			if(data[0].data!=null && data[0].data!='') {
				$(data[0].data).each(function(i) {
					buildWordsHtml+='<div><button type="button" class="btn" style="margin-bottom: 5px; background-color: #00CC66; border: 1px solid #00CC66;">'+data[0].data[i].word+'</button>';
					buildWordsHtml+='&nbsp;&nbsp;<button type="button" class="btn" style="margin-bottom: 5px; background-color: #66FF66; border: 1px solid #66FF66;">'+data[0].data[i].cipin+'</button>';
					buildWordsHtml+='&nbsp;&nbsp;<button type="button" class="btn" style="margin-bottom: 5px; background-color: #99FF33; border: 1px solid #99FF33;">'+data[0].data[i].ngd+'</button>'
					buildWordsHtml+='&nbsp;&nbsp;<button type="button" class="btn" style="margin-bottom: 5px; background-color: #CCFF99; border: 1px solid #CCFF99;">'+data[0].data[i].zyd+'</button></div><br>';
					
				});
				buildWordsCategoryHtml+='<div><button type="button" class="btn" style="margin-bottom: 5px; background-color: '+data[0].wordColor+'; border: 1px solid '+data[0].wordColor+';">'+data[0].wordText+'</button>';
				buildWordsCategoryHtml+='&nbsp;&nbsp;<button type="button" class="btn" style="margin-bottom: 5px; background-color: '+data[0].cipinColor+'; border: 1px solid '+data[0].cipinColor+';">'+data[0].cipinText+'</button>';
				buildWordsCategoryHtml+='&nbsp;&nbsp;<button type="button" class="btn" style="margin-bottom: 5px; background-color: '+data[0].ngdColor+'; border: 1px solid '+data[0].ngdColor+';">'+data[0].ngdText+'</button>'
				buildWordsCategoryHtml+='&nbsp;&nbsp;<button type="button" class="btn" style="margin-bottom: 5px; background-color: '+data[0].zydColor+'; border: 1px solid '+data[0].zydColor+';">'+data[0].zydText+'</button></div><br>';
			}else{
				buildWordsHtml+='<button type="button" class="btn" style="margin-bottom: 5px; background-color: #EEDFCC; border: 1px solid #EEDFCC;">数据为空！</button>';
				buildWordsCategoryHtml+='<button type="button" class="btn" style="margin-bottom: 5px; background-color: #EEDFCC; border: 1px solid #EEDFCC;">数据为空！</button>';
			}
			$("#buildWordsHtml").html(buildWordsHtml);
			$("#buildWordsCategoryHtml").html(buildWordsCategoryHtml);
		},
		error : function(data) {
			// alert("请求失败");
		}
	});
}

</SCRIPT>


<?} ?>

